package org.zephy.guomi;

import cn.hutool.core.util.HexUtil;
import cn.hutool.crypto.SmUtil;
import cn.hutool.crypto.asymmetric.SM2;

/**
 * 公钥私钥是字节类型
 * SM2签名和验签
 */
public class Sm2Test {
    public static void main(String[] args) {
        String content="hello world";
        final SM2 sm2= SmUtil.sm2();
        String sign=sm2.signHex(HexUtil.encodeHexStr(content));
        System.out.println(sign);

        boolean verify=sm2.verifyHex(HexUtil.encodeHexStr(content),sign);
        System.out.println(verify);
    }
}
